package com.nh.log.controller;

import com.nh.log.service.LogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Author: LaoCao
 * @Date: 2023/3/15 21:01
 * @Version: 1.0
 **/
@Slf4j
@Api("日志分析服务")
@RestController
@RequestMapping("/admin/log")
public class LogPrintController {
    @Resource
    private LogService logService;

    @ApiOperation("打印日志")
    @GetMapping("/print")
    public String logPrint(){
        logService.logPrint();
        return "ok";
    }

    @ApiOperation("分析指定日期的日志")
    @GetMapping("/analyse")
    public String logAnalyse(
            @ApiParam("日期格式：yyyy-MM-dd") @RequestParam String date){
        logService.logAnalyse(date);
        return "ok";
    }

}
